# TODO: Add comment
# 
# Author: Roger
###############################################################################

setClass("Equity",
		contains=c(
				"Quantity",
				"SituationDate",
				"Currency",
				"Name",
				"Exchange",
				"Price"
				)
)

Equity <- function(Quantity,SituationDate,Currency,Name,Exchange,Price){
	new("Equity",Quantity=Quantity,SituationDate=SituationDate,Currency=Currency,Name=Name,Exchange=Exchange,Price=Price)
}

# x <- object <- Equity(100,Sys.Date(),"CHF","SMI Index","SWISSEXCHANGE",100)

setMethod("show","Equity",function(object){
			cat("Name: ",name(object),"\n",sep="")
			cat("Currency: ",currency(object),"\n",sep="")
			cat("Quantity: ",quantity(object),"\n",sep="")
			cat("Price: ",price(object),"\n",sep="")
		})

setMethod("presentValue",signature=c("Equity","missing"),function(object,arg1){
			price(object) * quantity(object)
		})

setMethod("presentValue",signature=c("Equity","DiscountFactor"),function(object,arg1){
			price(object) * quantity(object)
		})

setMethod("presentValue",signature=c("Equity","numeric"),function(object,arg1){
			quantity(object) * arg1
		})

setMethod("presentValue",signature=c("Equity","MarketDataEquity"),function(object,arg1){
			quantity(object) * price(arg1)[name(object)==name(arg1)]
		})

setMethod("strike",signature=c("Equity"),function(object){
			price(object)
		})

setMethod("maturityDate",signature=c("Equity"),function(object){
			NA
		})

setMethod("underlying",signature=c("Equity"),function(object){
			name(object)
		})

setMethod("delta",signature=c("Equity","numeric"),function(object,arg1){
			quantity(object)
		})

setMethod("gammma",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("deltagamma01",signature=c("Equity","numeric"),function(object,arg1){
			delta(object,arg1)
		})

setMethod("deltagamma01empirical",signature=c("Equity","numeric"),function(object,arg1){
			presentValue(object,arg1+1) - presentValue(object,arg1)
		})

setMethod("theta",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("vega",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("vomma",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("vegavomma01",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("vegavomma01empirical",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("rho",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("rho2",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("dv01",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("dv01",signature=c("Equity","DiscountFactor"),function(object,arg1){
			0
		})

setMethod("dv01empirical",signature=c("Equity","numeric"),function(object,arg1){
			0
		})
		
setMethod("rhoCoC",signature=c("Equity","numeric"),function(object,arg1){
			0
		})

setMethod("rhoCoC2",signature=c("Equity","numeric"),function(object,arg1){
			0
		})


		
		
		
